﻿CREATE PROCEDURE [dbo].[sp_ara_querybyperson]
	@batchid uniqueidentifier,
	@name nvarchar(32),
	@begintime datetime,
	@endtime datetime
AS
	select R.* from t_ara_record as R
		inner join t_ara_person as P on P.Account = R.Account
	where R.BatchId = @batchid and P.Name like '%'+@name+'%'
		and (R.LoginTime >= @begintime or R.LogoutTime >= @begintime)
		and (R.LogoutTime <= @endtime or R.LoginTime <= @endtime)
	order by R.Account

RETURN 0
